#define _CRT_SECURE_NO_WARNINGS
#include"saolei.h"
int main() {
	int row = 0, col = 0, mine = 0;
	int level = 0;

	scanf("%d", &level);
	switch (level)
	{
	case 1:
		row = 9;
		col = 9;
		mine = 10;
		game(row, col, mine);
	case 2:
		row = 16;
		col = 16;
		mine = 40;
		game(row, col, mine);
	case 3:
		row = 16;
		col = 30;
		mine = 99;
		game(row, col, mine);
	case 4:
		scanf("%d%d%d", &row, &col, &mine);
		if (row >= 9 && row <= 24 && col >= 9 && col <= 30 && mine >= 10 && mine <= (int)(row * col * 0.9)) {
			game(row, col, mine);
		}
	}
	return 0;
}